1.6 Representation of Negative Numbers
There are two common methods for representing negative numbers
using binary digits: signed-magnitude and complement number
systems. These methods are widely used in computer systems.
Part 1.6.1 Signed-magnitude System
In binary numbers, an extra bit is used to indicate the sign,
often referred to as the sign bit. This sign bit is typically located at the
most significant bit (MSB) position, where 1 represents a positive value and 0
represents a negative value. The remaining bits hold the magnitude of the
number.
For Examples
010101012 = -85
110101012 = 85
011111112 = -127
111111112 = 127
Part 1.6.2 Complement Number System
There are two types of complements used in number systems:
radix complement and radix minus one complement.
Part 1.6.2.a Diminished Radix Complement or Radix-Minus-One
Complement or (r-1)’s Complement System
Radix minus one
complement, also known as (r − 1)'s complement, is a method of
representing negative numbers in a positional numeral system. In this system,
to find the negative representation of a number, each digit is subtracted from
the radix (base) minus one and then the entire result is complemented (all 0s
changed to 1s and vice versa).
For example, in the decimal system (radix 10), the 9's
complement of 25 is 74.
Solution:
9 – 2
= 7
9 – 5
= 4
Let’s read it from top to bottom, the answer is 74.
In binary (radix 2),
the 1's complement of 1011 is 0100.
1 – 1
= 0
1 – 0
= 1
1 – 1
= 0
1 – 1
= 0
Let’s read it from top to bottom, the answer is 0100.
Radix minus one complements are used in some older computer architectures
and are still relevant in certain applications like checksum calculations and
error detection. However, they have largely been replaced by two's complement
representation, which is more efficient and widely used in modern computers.
Part 1.6.2.b Radix Complement or True Complement System
Radix complement, also
known as r's complement, is a method of representing negative numbers in a
positional numeral system. In this system, to find the negative representation
of a number, the entire number is subtracted from the radix (base) raised to the
power of the number of digits.
For example, in the decimal system (radix 10), the 10's
complement of 25 is 75.
Solution:
The radix-minus-one complement of 25 is 74. Add one in 74 = 75.
In binary (radix
2), the 2's complement of 1011 is 0101.
Solution:
The radix-minus-one of 1011 is 0100. Then add one to the 0100,
the answer is 0101.
Part 1.6.3 Subtraction using Complement Number System
Part 1.6.3.1 Using Radix-minus-one Complement
Procedure:
Step
1. Copy the minuend.
Step
2. Obtain the radix-minus-one complement of the subtrahend.
Step
3. Add the radix-minus-one complemented subtrahend to the
minuend.
Step
4. Handle carry-over: a. If the outmost carry-over from step 3
is '1', add this to the least significant digit obtained in step 3. b. If the
outmost carry-over from step 3 is '0', take the radix-minus-one complement of
the result in step 3 and prefix the negative sign.
Example
No. 1
Subtract 17 from 92
Solution.
Step 1. Copy the minuend.
92
Step
2. Obtain the radix-minus-one complement of the subtrahend.
9 – 1 = 8
9 – 7 = 2
Let’s read it from top to bottom: 82
Step
3. Add the radix-minus-one complemented subtrahend to the
minuend.
92
+ 82 = 174
Step
4. Handle carry-over: a. If the outmost carry-over from step 3 is '1', add this to the least
significant digit obtained in step 3. b. If the outmost carry-over from
step 3 is '0', take the radix-minus-one complement of the result in step 3 and
prefix the negative sign.
74 + 1 = 75 This is
the Answer.
Example
No. 2
Subtract 111 from 110010
Solution.
Step 1. Copy the minuend.
110010
Step
2. Obtain the radix-minus-one complement of the subtrahend.
1 |
1 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
The Radix-minus-one of 000111 is 111000
Step
3. Add the radix-minus-one complemented subtrahend to the
minuend.
110010
+ 111000 = 1101010
Step
4. Handle carry-over: a. If the outmost carry-over from step 3 is '1', add this to
the least significant digit obtained in step 3. b. If the outmost
carry-over from step 3 is '0', take the radix-minus-one complement of the
result in step 3 and prefix the negative sign.
Add 1 to 101010 =
1010112 this is our answer.
Example
No. 4
Subtract 110010 from 000111
Solution:
Step 1. Copy the minuend.
000111
Step
2. Obtain the radix-minus-one complement of the subtrahend.
The radix-minus-one complement of subtrahend is 001101
Step
3. Add the radix-minus-one complemented subtrahend to the
minuend.
Add 000111 and 001101, the answer is 010100.
Step
4. Handle carry-over: a. If the outmost carry-over from step 3
is '1', add this to the least significant digit obtained in step 3. b. If the outmost carry-over
from step 3 is '0', take the radix-minus-one complement of the result in step 3
and prefix the negative sign.
The radix-minus-one complement of 010100 is 101011 and add negative sign.
Our answer is -101011.
Part 1.6.3.2 Using Radix Complement
Procedure:
Step
1. Copy the minuend.
Step
2. Obtain the true complement of the subtrahend.
Step
3. Add the true complemented subtrahend to the minuend.
Step
4. Handle carry-over: a. If the outmost carry-over from step 3
is '1', discard it. b. If the outmost carry-over from step 3 is '0', take the
true complement of the result in step 3 and prefix the negative sign.
Step
5. The obtained result in step 4 is the difference between the
two numbers.
Example
No. 5
Subtract 17 from 92
Solution:
Step
1. Copy the minuend.
92
Step
2. Obtain the true complement of the subtrahend.
Let’s get first the radix-minus-one complement of 17
9 – 1 = 8
9 – 7 = 2
The radix-minus-one complement of 17 is 82, then add one.
Therefore, the true compliment of 17 is 83.
Step
3. Add the true complemented subtrahend to the minuend.
Add 83 and 92, the sum is 175.
Step
4. Handle carry-over: a. If the outmost carry-over from step 3 is '1', discard it. b.
If the outmost carry-over from step 3 is '0', take the true complement of the
result in step 3 and prefix the negative sign
Our answer is 75.
Example
No. 6
Subtract 111 from 110010
Solution:
Step
1. Copy the minuend.
110010
Step
2. Obtain the true complement of the subtrahend.
The radix-minus-one complement of 000111 is 111000.
Therefore, the true compliment of 000111 is 111000 + 1 = 111001.
Step
3. Add the true complemented subtrahend to the minuend.
Add 110010 and 111001, the sum is 1101011.
Step
4. Handle carry-over: a. If the outmost carry-over from step 3 is '1', discard it. b.
If the outmost carry-over from step 3 is '0', take the true complement of the
result in step 3 and prefix the negative sign
Our answer is 1010112.
Example
No. 7
Subtract 110010 from 000111
Solution:
Step
1. Copy the minuend.
000111
Step
2. Obtain the true complement of the subtrahend.
The radix-minus-one complement of 110010 is 001101.
Therefore, the true compliment of 110010 is 001101 + 1 = 001110.
Step
3. Add the true complemented subtrahend to the minuend.
Add 000111 and 001110, the sum is 010101.
Step
4. Handle carry-over: a. If the outmost carry-over from step 3
is '1', discard it. b. If
the outmost carry-over from step 3 is '0', take the true complement of the
result in step 3 and prefix the negative sign.
The Radix-minus-one complement of 010101 is 101010. Then add 1
to 101010 to get the true complement.
Our answer is –
1010112.